/**
 * @type {String}
 *
 * @properties={typeid:35,uuid:"6B9AE09A-ACC5-40E2-8180-53AAC059A733"}
 */
var $pwd_original = "";

/**
 * @type {String}
 *
 * @properties={typeid:35,uuid:"3CFFCAB7-CA05-4AC9-BCCF-6264729F0F27"}
 */
var $pwd1 = "";

/**
 * @type {String}
 *
 * @properties={typeid:35,uuid:"16A14814-E3A2-4291-9953-CF628DFB4A8F"}
 */
var $pwd2 = "";

/**
 * Comprueba contraseñas
 * @author Roberto J. Blasco
 * @version 1.0
 * @param {JSEvent} event
 * @return {Boolean}
 * @properties={typeid:24,uuid:"D3A1B5EF-9F27-474D-A2F4-A0E23BB336B5"}
 */
function aceptar_antes(event){
	
	return true;
}

/**
 * Callback method for when form is shown.
 *
 * @param {Boolean} firstShow form is shown first time after load
 * @param {JSEvent} event the event that triggered the action
 *
 * @private
 *
 * @properties={typeid:24,uuid:"9FA90164-4C00-419F-AE44-E8E56DC5854D"}
 */
function onShow(firstShow, event) {

	$pwd_original = null;
	$pwd1 = null;
	$pwd2 = null;
}

/**
 * Cancelar
 * @author Roberto J. Blasco
 * @version 1.0
 * @param {JSEvent} event the event that triggered the action
 * @private
 * @properties={typeid:24,uuid:"ACECFAD1-2815-4DD2-AC94-2C576A3673B7"}
 */
function cancelar(event) {

	
}

/**
 * Aceptar
 * @author Roberto J. Blasco
 * @version 1.0
 * @param {JSEvent} event the event that triggered the action
 * @return {Boolean}
 * @private
 * @properties={typeid:24,uuid:"4658A3FF-B400-487B-B9AC-7564123CB33F"}
 */
function aceptar(event) {

	// TODO Revisar condiciones
	if (s_md5_pwd != utils.stringMD5HashBase64($pwd_original)){
		application.output("Las contraseñas no coinciden");
		return false;
	}else if ($pwd1 != $pwd2){
		application.output("Las contraseñas no coinciden");
		return false;
	}
	
	s_md5_pwd = utils.stringMD5HashBase64($pwd1);
	globals.saveEdits_record(foundset.getSelectedRecord());
	
	return true;
}
